<!DOCTYPE html>
<html lang="zh-CN">
<html>
<head>
	<title>文件管理器</title>
	<link rel="stylesheet" type="text/css" href="<?php echo base_url('static/css/reset.css');?>" />
	<link rel="stylesheet" type="text/css" href="<?php echo base_url('static/css/style.css');?>" />
	<meta charset="UTF-8" />
	<link rel="stylesheet" href="<?php echo base_url('static/js/kindeditor/themes/default/default.css');?>" />
	<style type="text/css">

	::selection{ background-color: #E13300; color: white; }
	::moz-selection{ background-color: #E13300; color: white; }
	::webkit-selection{ background-color: #E13300; color: white; }

	body {
		background-color: #fff;
		margin: 40px;
		font: 13px/20px normal Helvetica, Arial, sans-serif;
		color: #4F5155;
	}

	a {
		color: #003399;
		background-color: transparent;
		font-weight: normal;
	}

	h1 {
		color: #444;
		background-color: transparent;
		border-bottom: 1px solid #D0D0D0;
		font-size: 19px;
		font-weight: normal;
		margin: 0 0 14px 0;
		padding: 14px 15px 10px 15px;
	}

	#body{
		margin: 0 15px 0 15px;
	}
	
	p.footer{
		text-align: right;
		font-size: 11px;
		border-top: 1px solid #D0D0D0;
		line-height: 32px;
		padding: 0 10px 0 10px;
		margin: 20px 0 0 0;
	}
	
	#container{
		margin: 10px;
		border: 1px solid #D0D0D0;
		-webkit-box-shadow: 0 0 8px #D0D0D0;
	}
	</style>
	<script type="text/javascript">
		var base_url = '<?php echo base_url();?>';
		var site_url = '<?php echo site_url();?>';
	</script>
</head>

<body>

<div id="container">
	<h1>欢迎使用文件管理器!</h1>

	<div id="body">

		<div class="file-manager">
			<div class="operate-box">
				<ul class="operate">
					<li><button class="btn"></button></li>
					<li><button class="btn upload"><i class="i i-upload"></i></button></li>
					<li><button class="btn new-folder"><i class="i i-new-folder"></i></button></li>
				</ul>
			</div>
			<form> <input type="hidden" name="current_dir" class="current_dir" value="" /> </form>
			<div class="search-box">
				<div class="path">
					<a href="#" class="root-dir">所有文件</a>
				</div>
			</div>
			<div class="content">
				<div class="icon-view">
					<div class="group">
						<ul>
							<?php foreach($ds as $key => $val): ?>
							<li>
								<i class="i icon-large i-00" style="width:100px;height:100px;"></i>
								<?php echo anchor('', $val, 'class="name"');?>
								<!-- <a class="name" href="http://www.baidu.com">application</a> -->
							</li>
							<?php endforeach; ?>

							<?php foreach($fs as $key => $val): ?>
							<li>
								<?php if(in_array(get_ext($val), $img_arr)):?>
								<i class="i icon-large i-00" style="background-image:url(<?php echo base_url('data/upload/'.$val);?>);background-size:contain;"></i>
								<!-- <img src="<?php echo base_url('data/upload/'.$val);?>" style="width:100px;height:100px;" /> -->
								<?php echo anchor('', $val, 'class="name"');?>
								<?php else: ?>
								<i class="i icon-large i-00" style="width:100px;height:100px;"></i>
								<?php echo anchor('', $val, 'class="name"');?>
								<?php endif; ?>

							</li>
							<?php endforeach; ?>
							
						</ul>
					</div>
				</div>
			</div>


		</div>

	</div>

	<p class="footer">Powered by <strong>Haowt</strong></p>
</div>
<script type="text/javascript" src="<?php echo base_url('static/js/jquery.min.js');?>"></script>
<script type="text/javascript" src="<?php echo base_url('static/js/file_manager.js');?>"></script>
<script type="text/javascript" src="<?php echo base_url('static/js/kindeditor/kindeditor-min.js');?>"></script>
<script type="text/javascript" src="<?php echo base_url('static/js/kindeditor/lang/zh_CN.js');?>"></script>

<script>

	KindEditor.ready(function(K) {
		current_dir = $(".current_dir").val();

		var editor = K.editor({
			allowFileManager : true,
			uploadJson : site_url + '/upload?dir='+current_dir,
		});
		K('.upload').click(function() {
			editor.loadPlugin('multiimage', function() {
				editor.plugin.multiImageDialog({
					clickFn : function(urlList) {
						var div = K('#J_imageView');
						div.html('');
						K.each(urlList, function(i, data) {
							div.append('<img src="' + data.url + '">');
						});
						editor.hideDialog();
					}
				});
			});
		});
	});
</script>

</body>
</html>